package com.alibaba.weex.module;

import com.nat.recorder.HLModuleResultListener;
import com.nat.recorder.HLRecorderModule;
import com.taobao.weex.annotation.JSMethod;
import com.taobao.weex.bridge.JSCallback;
import com.taobao.weex.common.WXModule;

import java.util.HashMap;


/**
 * 录音模块
 *
 * @version 1.0
 * @since 2017/7/2
 */
public class RecorderModule extends WXModule {

    @JSMethod
    public void start(HashMap<String, String> param, final JSCallback jsCallback) {
        HLRecorderModule.getInstance().start(param, new HLModuleResultListener() {
            @Override
            public void onResult(Object o) {
                jsCallback.invoke(o);
            }
        });
    }

    @JSMethod
    public void pause(final JSCallback jsCallback) {
        HLRecorderModule.getInstance().pause(new HLModuleResultListener() {
            @Override
            public void onResult(Object o) {
                jsCallback.invoke(o);
            }
        });
    }

    @JSMethod
    public void stop(final JSCallback jsCallback) {
        HLRecorderModule.getInstance().stop(new HLModuleResultListener() {
            @Override
            public void onResult(Object o) {
                jsCallback.invoke(o);
            }
        });
    }
}
